package oneweone.com.readerviewdemo;

import android.Manifest;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;

import java.io.File;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private ReaderView mReaderView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ActivityCompat.requestPermissions(this,
                new String[]{
                        Manifest.permission.READ_EXTERNAL_STORAGE,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);

        mReaderView = findViewById(R.id.reader_view);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.display_btn:
                mReaderView.displayFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "a.pptx"));
                break;
        }
    }
}
